package A;

import java.util.Arrays;

public class Fib {
    public static void main(String[] args) {
        int n=30;
        int[] arr=new int[30];
        arr[0]=0;
        arr[1]=1;
        fib(arr,n-1);
        System.out.println(Arrays.toString(arr));
    }

    private static int fib(int[] arr, int n) {
        if(n==0){
            return 0;
        }
        if(n==1){
            return 1;
        }
        arr[n]=fib(arr,n-1)+fib(arr,n-2);
        return arr[n];
    }
}
